import 'package:flutter/material.dart';

import '../../databases/booklist.dart';
import '../../widgets/common_image.dart';

class NovelDetailOtherBook extends StatefulWidget {
  NovelDetailOtherBook({Key? key}) : super(key: key);

  @override
  State<NovelDetailOtherBook> createState() => _NovelDetailOtherBookState();
}

class _NovelDetailOtherBookState extends State<NovelDetailOtherBook> {
  @override
  Widget build(BuildContext context) {
    var width = MediaQuery.of(context).size.width*0.33-20;

    return Container(
      padding: EdgeInsets.all(10.0),
      child: Column(
        children: [
          Padding(
            padding: EdgeInsets.only(bottom: 10.0),
            child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
              Text(
                '大家还看过',
                style: TextStyle(
                    fontSize: 18.0,
                    fontWeight: FontWeight.w500,
                    color: Colors.black),
              ),
              GestureDetector(
                onTap: () {},
                child: Text(
                  '换一换',
                  style: TextStyle(color: Colors.grey),
                ),
              )
            ]),
          ),
          Divider(height: 1.0,),
          SizedBox(height: 10.0,),
          Wrap(
            runSpacing: 10,
            spacing: 10,
            children: bookListData
                .map((item) => GestureDetector(
                      onTap: () {},
                      child: Container(
                        width: width,
                          height: 130,
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Container(
                                  width: 100.0,
                                  height: 100.0,
                                  child: CommonImage(item.bookListImgUrl!)),
                              Text('${item.title!}')
                            ],
                          )),
                    ))
                .toList(),
          )
        ],
      ),
    );
  }
}
